from django.shortcuts import render
from rest_framework.response import Response
from rest_framework.views import APIView

from home import models, homeser


# Create your views here.

class BannerView(APIView):
    def get(self, request):
        banners = models.Banner.objects.all()
        serializer = homeser.bannerSerializer(banners, many=True)  # 确保传递 data 参数
        return Response({"msg": "ok", "data": serializer.data})
